<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="shortcut icon" href="file:///C|/wamp/www/assets/ico/favicon.ico">
    <link href="../css/paginator.css" rel="stylesheet" type="text/css">
    <link href="../css/estilo.css" rel="stylesheet" type="text/css">
    <link href="../css/box.css" rel="stylesheet" type="text/css">


    <!-- Bootstrap core CSS -->
    <link href="../css/bootstrap.css" rel="stylesheet" media="screen">
    <!-- Just for debugging purposes. Don't actually copy this line! -->
    <!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
    <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
      <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
    <title>Proyecto SGA</title>
</head>

<body class="fondo">
<div id="hld">

   


<div class="container">
<div class="panel panel-default">
<div class="panel-body">
  <!-- Main component for a primary marketing message or call to action -->
  
  
  <div class="well well-lg">
    <div class="imagen_head"><img src="../img/header/icon-48-category.png" width="48" height="48"></div>
    <div class="titulo_head">Gestor de Niveles</div>
    <div class="toolbar_head">
      <div class="btn-toolbar" role="toolbar">
    	<a href="registrar_nivel.php" class="btn btn-primary"><span class="glyphicon glyphicon-plus"></span><br> Nuevo</a>
<a href="index.php" class="btn btn-danger"><span class="glyphicon glyphicon-remove"></span><br>Cerrar</a>		
	
                  <button type="button" class="btn btn-default">
                    <span class="glyphicon glyphicon-question-sign"></span><br> Ayuda
                  </button>
     
      </div><!-- /btn-toolbar -->  
    </div><!-- /toolbar head -->  
  </div><!-- /Well -->   
<?php
include_once("../institucion/nivel/ClsNivel.php");
$objnivel=new ClsNivel;
$accion=$_POST["accion"];


if ($accion=="guardar") {
	$nombre=$_POST["txtNombre"];
	if ($objnivel->agregarNivel($nombre)==true)
	{
		$resultado=$objnivel->consultarNivelIdMaximo();
		$mensaje="Registro grabado correctamente";

	}else{
		$mensaje="Error de grabacion";

	}
	
	while($row=mysql_fetch_array($resultado))
	{
		$idnivel=$row['Maximo'];
	}
	echo "<div class='alert alert-info'><span class='glyphicon glyphicon-ok'></span>&nbsp;&nbsp;&nbsp;".$mensaje."</div>";
}

if ($accion=="modificar") 
{
	$idnivel=$_POST["codigo"];
	$nombre=$_POST["txtNombre"];

	$objnivel=new clsNivel;
	if ($objnivel->modificarNivel($idnivel,$nombre)==true)
	{
		$mensaje="Registro actualizado correctamente";
	}else{
		$mensaje="Error de grabacion";
	}
	
		echo "<div class='alert alert-success'><span class='glyphicon glyphicon-ok'></span>&nbsp;&nbsp;&nbsp;".$mensaje."</div>";
}



?>


     

  
<div class="panel panel-default">
  <!-- Default panel contents -->
	<div class="panel-body">
    
    
    <form name="frmDetalleNivel" action="guardar_nivel.php" method="post" class="form-horizontal" role="form">
	<fieldset>
    <legend>Detalles</legend>
    <div class="form-group">
    	<label for="txtIdNivel" class="col-sm-2 control-label">ID Nivel:</label>
        <div class="col-sm-3">
            <input name="txtIdNivel" type="text"  required class="form-control" id="txtIdNivel" value="<?php echo $idnivel ?>" disabled>
        </div>
  	</div>
	<div class="form-group">
    	<label for="txtNombre" class="col-sm-2 control-label">Descripción:</label>
        <div class="col-sm-3">
            <input name="txtNombre" type="text"  required class="form-control" id="txtNombre" title="Se necesita un nombre de nivel" value="<?php echo $nombre ?>" disabled>
        </div>
  	</div>


        
    </fieldset>
    </form>


  </div><!-- /panel-body -->
</div><!-- /panel-default -->


</div><!-- /panel general -body -->
</div><!-- /panel general -default -->
</div> <!-- /container -->


    <!-- Bootstrap core JavaScript
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
    <script src="../js/jquery.min.js"></script>
    <script src="../js/bootstrap.min.js"></script>
    </div>
  </body>
</html>